using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace CubicFWNet.Data.Models.Mapping
{
    public class ProductMap : EntityTypeConfiguration<Product>
    {
        public ProductMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .HasMaxLength(256);

            this.Property(t => t.Number)
                .HasMaxLength(64);

            this.Property(t => t.Format)
                .HasMaxLength(64);

            this.Property(t => t.Memo)
                .HasMaxLength(1024);

            this.Property(t => t.Unit)
                .HasMaxLength(128);

            this.Property(t => t.CreatorName)
                .HasMaxLength(64);

            this.Property(t => t.Price)
                .HasPrecision(18, 8);

            this.Property(t => t.SizeLenth)
                .HasMaxLength(64);
            this.Property(t => t.SizeWidth)
                .HasMaxLength(64);

            //this.Property(t => t.Image1)
            //    .HasMaxLength(1024);

            //this.Property(t => t.Image2)
            //    .HasMaxLength(1024);

            //this.Property(t => t.Pack)
            //    .HasMaxLength(128);

            //    this.Property(t => t.Explain)
            //  .HasMaxLength(1024);

            //    this.Property(t => t.Color)
            //  .HasMaxLength(128);

            //    this.Property(t => t.Angel)
            //.HasMaxLength(128);

            // Table & Column Mappings
            this.ToTable("Product");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.CategoryId).HasColumnName("CategoryId");
            this.Property(t => t.Number).HasColumnName("Number");
            //this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Price).HasColumnName("Price");
            this.Property(t => t.Format).HasColumnName("Format");
            this.Property(t => t.SizeWidth).HasColumnName("SizeWidth");
            this.Property(t => t.SizeLenth).HasColumnName("SizeLenth");
            //this.Property(t => t.Pack).HasColumnName("Pack");
            //this.Property(t => t.Data).HasColumnName("Data");
            this.Property(t => t.CreatorId).HasColumnName("CreatorId");
            this.Property(t => t.CreatorName).HasColumnName("CreatorName");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.Memo).HasColumnName("Memo");
            //this.Property(t => t.Image1).HasColumnName("Image1");
            //this.Property(t => t.Image2).HasColumnName("Image2");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.ExecuteDepartment).HasColumnName("ExecuteDepartment");


            //this.Property(t => t.Quantity).HasColumnName("Quantity");

            //this.Property(t => t.Angel).HasColumnName("Angel");
            //this.Property(t => t.Tolerance).HasColumnName("Tolerance");
            //this.Property(t => t.ToleranceMinus).HasColumnName("ToleranceMinus");
            //this.Property(t => t.Space).HasColumnName("Space");
            //this.Property(t => t.Margin).HasColumnName("Margin");
            //this.Property(t => t.Distance).HasColumnName("Distance");

            //this.Property(t => t.WorkType).HasColumnName("WorkType");
            //this.Property(t => t.PackRequire).HasColumnName("PackRequire");
            //this.Property(t => t.PackAmount).HasColumnName("PackAmount");
        }
    }
}
